package com.bml.architect.netty.serialiable.codec;

import com.bml.architect.entity.User;
import com.bml.architect.util.ProtostuffUtil;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

import java.io.Serializable;

public class ProtostuffEncoder extends MessageToByteEncoder<User> {
    @Override
    protected void encode(ChannelHandlerContext ctx, User msg, ByteBuf out) throws Exception {
        out.writeBytes(ProtostuffUtil.serializer(msg));
    }
}
